﻿using System;
using System.Data;
using System.Collections.Generic;

using System.Text;
using KPIS.GERP.ESS.MODEL;
using KPIS.GERP.ESS.DAL;

namespace KPIS.GERP.ESS.BLL
{
    public class ActivityRequestBLL
    {
        private static readonly ActivityRequestDAL dal = new ActivityRequestDAL();
        ConvertNullable.ConvertNullable cn = new ConvertNullable.ConvertNullable();

        public DataSet GetActRequest(Nullable<int> Sequence, Nullable<int> EmployeeSequence, Nullable<int> HasGranted)
        {
            return dal.GetActRequest(Sequence, EmployeeSequence, HasGranted);
        }
        public int GetLastInsertActivityRequest()
        {
            return dal.GetLastInsertActivityRequest();
        }
        public DataSet GetActHistory(Nullable<int> EmployeeSequence)
        {
            return dal.GetActHistory(EmployeeSequence);
        }
        public DataSet GetMsgSend(string seq)
        {
            int iseq = Convert.ToInt32(seq);
            return dal.GetMsgSend(iseq);
        }
        public void InsertActRequest(string act_seq, string emp_seq, string granted, string remarks, string created_by)
        {
            int iact_seq = Convert.ToInt32(act_seq);
            int iemp_seq = Convert.ToInt32(emp_seq);
            Nullable<int> igranted = cn.ConvertNullInt(granted);
            int icreated_by = Convert.ToInt32(created_by);

            dal.InsertActRequest(iact_seq, iemp_seq, igranted, remarks, icreated_by);
        }

        public void UpdateSendStatus(string send_seq, string msg_status, string updated_by)
        {
            int isend_seq = Convert.ToInt32(send_seq);
            int imsg_status = Convert.ToInt32(msg_status);
            int iupdated_by = Convert.ToInt32(updated_by);
            dal.UpdateSendStatus(isend_seq, imsg_status,iupdated_by);
        }
    }
}
